unit ULowGravity;

interface

uses SysUtils, Windows, Classes, Math, UMapObjekte, UPictureName, UPlayer;

type
  TLowGravity = class(TMapObject) // 17
  private
    used: boolean;
  public
    constructor Create(Id: integer); Override;
    function getCollisionAtPixel(Game: TObject; X, Y: integer): integer;
      Override;
  end;

implementation

uses UGame;
{ TLowGravity }

constructor TLowGravity.Create(Id: integer);
begin
  self.Id := Id;
  self.Num := 17;
  self.used := False;
  FPictureName := b_Gravity_low;
end;

function TLowGravity.getCollisionAtPixel(Game: TObject; X, Y: integer): integer;
var
  vgame: TGame;
begin
  vgame := Game as TGame;
  if ((vgame.getTexturePack.GetNamedPicture(self.PictureName)
        .Bitmap.Canvas.Pixels[X, Y] = RGB(250, 0, 250)) or
      (vgame.getTexturePack.GetNamedPicture(self.PictureName)
        .Bitmap.Canvas.Pixels[X, Y] = -1)) then
  begin
    result := 0
  end
  else
  begin
    if (vgame.getTexturePack.GetNamedPicture(self.PictureName)
        .Bitmap.Canvas.Pixels[X, Y] = RGB(255, 255, 0)) then
    begin
      result := 7;
      self.used := True;
    end
    else
      result := 8;
  end;
end;

end.
